home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 October: Mac OS SDK / Dev.CD Oct 97 SDK1.toast / Development Kits (Disc 1) / QuickDraw GX / Programming Stuff / Sample Code / Graphics Samples / Getting Started w⁄GX ƒ / Getting Started GX - main.h < prev    next >
Encoding:
Text File  |  1996-03-20  |  5.0 KB  |  187 lines  |  [TEXT/KAHL]

  1. /**
  2.  --
  3.  --        App:        Getting Started w/QD GX (WWDC)
  4.  --
  5.  -- 
  6.  --        Version:    1.0     4/93:    added all of the calls required to support the "Getting 
  7.  --                                    Started with QuickDraw™ GX" session at the WWDC '93     
  8.  --                            3/94:    dmh - general cleanup/debugging.
  9.  --
  10.  --        File:        Getting Started GX - main.h
  11.  --
  12.  --
  13.  --        Comments:    This file contains all of the variable and function declarations used.
  14.  --
  15.  --
  16.  --        Components:    Getting Started GX - main.c
  17.  --                    Getting Started GX - main.h
  18.  --                    Getting Started GX - shapes.c
  19.  --                    Getting Started GX - printing.c
  20.  --                    Getting Started GX - misc.c
  21.  --                    Getting Started QD GX.π.rsrc
  22.  --
  23.  --                    The file titled: "Getting Started GX - main.c" contains the code required to
  24.  --                    intialize and tear down the QuickDraw GX world, and the event loop.
  25.  --
  26.  --                    The file titled: "Getting Started GX - shapes.c" contains of the code used to 
  27.  --                    create and manipulate the shapes draw into the window.
  28.  --        
  29.  --                    The file titled: "Getting Started GX - printing.c" contains of the code used to 
  30.  --                    print the contents of  the window.
  31.  --        
  32.  --                    The file titled: "Getting Started GX - misc.c" contains of the code for the utilities used.
  33.  --        
  34.  --        
  35.  --        QuickDraw GX
  36.  --        Libraries
  37.  --        Used:        This application uses the following QuickDraw GX library code files:
  38.  --                    "gxColor library.c", "gxFont library.c", "graphics debug library.c",
  39.  --                    "layout library.c", "qd library.c", "gxShape library.c", 
  40.  --                    "gxTransferMode library.c", and "gxTransform library.c". 
  41.  --        
  42.  --        
  43.  --        Notes:        1) Print this file in landscape for the best results
  44.  --                    2) If you are using THINK C v5.x, I have added THINK markers to navigate the code.
  45.  --                    3) This code was adapted from the "Banana Jr." QuickDraw GX sample.
  46.  --
  47.  --
  48.  --        Author:        Pete "Luke" Alexander
  49.  --                    Developer Technical Support
  50.  --                    AppleLink: DEVSUPPORT
  51.  --
  52.  --        
  53.  --        ©1992 - 1993  Apple Computer, Inc. 
  54.  --        All rights reserved.
  55.  --
  56.  **/
  57.  
  58. //
  59. // The following are expected to be initialized by the application:
  60. //
  61.  
  62. extern Rect             gWindowQDRect;
  63. extern Str255            gWindowTitle;
  64. extern Boolean            gDebugging;
  65. extern Boolean            gGiveMeValidation;
  66. extern long                gGraphicsHeapSize;
  67.  
  68. extern gxStyle            gOurStyle;
  69. extern gxColor             gTextColor;
  70. extern gxTransform        gRotatedTransform;
  71. extern gxPoint            gTextLocation;
  72.  
  73. //
  74. //     All of the previously declared variables are initialized in the "Getting Started GX - shapes.c" file.
  75. //
  76.  
  77.  
  78. //
  79. //     The following variable is initialized in"Getting Started GX - main.c" :
  80. //
  81. extern Boolean            gQuitting;
  82.  
  83.  
  84. //
  85. //    The following functions are supplied by the application
  86. //    using the shell and are called at the appropriate time.
  87. //
  88.  
  89. //
  90. //    Declared in: Getting Started GX - main.c:
  91. //
  92. void main(void);
  93. void EventLoop(void);
  94. void MyDoEvent(EventRecord *theEvent);
  95. OSErr MyPrintingEventOverride(EventRecord *anEvent, Boolean filterEvent);
  96.  
  97. //
  98. //    Declared in: Getting Started GX - shapes.c:
  99. //
  100. OSErr DoInitialization(WindowPtr);
  101. void DoDraw(WindowPtr);
  102. OSErr DoCreateNew(void);
  103. void DoDispose(WindowPtr);
  104. void DoIdle(WindowPtr);
  105.  
  106. void CreateNewLayoutShape (WindowPtr);
  107. void AddKanjiToLayout (WindowPtr);
  108. void PerspectLayout(WindowPtr);
  109.  
  110. void CreateABlackRectangle (WindowPtr);
  111. void ColorTheRectangle (WindowPtr);
  112. void CreateAQ (WindowPtr);
  113. void OutlineTheQ (WindowPtr);
  114. void CreateAD (WindowPtr);
  115. void CreateAG (WindowPtr);
  116. void CreateAX (WindowPtr);
  117.  
  118.  
  119. //
  120. //    Declared in: Getting Started GX - misc.c:
  121. //
  122. void DoMenuCommand(long menuResult);
  123. gxJob GetDocJob(WindowPtr);
  124. gxShape GetDocShape(WindowPtr);
  125.  
  126.  
  127. //
  128. //    Declared in: Getting Started GX - printing.c:
  129. //
  130. void SetUpEditMenuRec(gxEditMenuRecord *);
  131. OSErr DoFormat(WindowPtr, gxDialogResult *);
  132. OSErr DoPrinting(WindowPtr);
  133. OSErr DoPrintLoop(WindowPtr);
  134. OSErr DoPrintOneCopy(WindowPtr);
  135. OSErr MyReplaceCollectionItem(void *newData, long collectSize,
  136.                               OSType collectType, long collectID,
  137.                               Collection whichCollection,
  138.                               Ptr *oldData, long *oldDataSize);
  139.  
  140. //
  141. // Resource & menu item equates:
  142. //
  143. #define rMenuBar            128
  144. #define mApple                128
  145. #define     iAbout            1
  146.  
  147. #define mFile                129
  148. #define     iNew            1
  149. #define     iOpen            2
  150. #define     iClose            3
  151. #define     iSave            4
  152. #define     iDocumentSetup    6
  153. #define     iByPageSetup    7
  154. #define     iPrint            8
  155. #define     iPrintOne        9
  156. #define     iQuit              11
  157.  
  158. #define mEdit                130
  159. #define     iUndo            1
  160. #define     iCut                3
  161. #define     iCopy            4
  162. #define     iPaste            5
  163. #define     iClear            6
  164.  
  165. #define mGraphics                131
  166. #define     iCreateABlackRectangle    1
  167. #define     iColorTheRectangle        2
  168. #define     iCreateAQ            3
  169. #define     iOutlineTheQ            4
  170. #define    iCreateAD             5
  171. #define    iCreateAG                6
  172. #define     iCreateAX                7
  173.  
  174. #define mTypography        132
  175. #define     iCreateLayout        1
  176. #define     iAddKanjiToLayout    2
  177. #define     iPerspectLayout    3
  178.  
  179. //        
  180. //     This is the structure we use to hold our private data for each window.  We store a handle to one of these beasties
  181. //     in each window's refCon field.
  182. //
  183. typedef struct {
  184.               gxJob        docJob;        // print job for this document.
  185.               gxShape        docPage;        // page gxShape description for this document.
  186.             } T_Doc, *TP_Doc, **TH_Doc;
  187.